<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <title>标签管理</title>
    <th:block th:replace="admin/_fragments :: somehead"></th:block>
</head>

<body>
    
    <nav th:replace="admin/_fragments :: backnav(3)"></nav>

    <div class="ui attached pointing menu">
        <div class="ui container">
            <a th:href="@{/admin/tags/input}" class="item">添加标签</a>
            <a th:href="@{/admin/tags}" class="active orange item">标签列表</a>
        </div>
    </div>

    <div class="fluid container m-padded-tb-large">
        <div class="ui container">
        	<div class="ui success message" th:unless="${#strings.isEmpty(message)}">
        		<i class="close icon"></i>
        		<div class="header">提示：</div>
        		<p th:text="${message}"></p>
        	</div>
            <table class="ui celled table">
                <thead>
                    <tr>
                        <th></th>
                        <th>名称</th>
                        <th>操作</th>
                    </tr>
                </thead>
                    <tbody>
                        <tr th:each="tag,iterStat : ${page.content}">
                            <td th:text="${iterStat.count}"></td>
                            <td th:text="${tag.name}"></td>
                            <td>
                                <a href="#" th:href="@{/admin/tags/{id}/input(id=${tag.id})}" class="ui mini teal button">编辑</a>
                                <a href="#" th:href="@{/admin/tags/{id}/delete(id=${tag.id})}" class="ui mini red button">删除</a>
                            </td>
                        </tr>
                    </tbody>
                    <tfoot>
                        <tr>
                            <th colspan="6">
                                <div class="ui pagination menu" th:if="${page.totalPages}>1">
                                    <a href="#" th:href="@{/admin/tags/(page=${page.number}-1)}" th:unless="${page.first}" class="icon mini item">
                                        <i class="left chevron icon"></i>
                                    </a>

                                    <a href="#" th:href="@{/admin/tags/(page=${page.number}+1)}" th:unless="${page.last}" class="icon mini item">
                                        <i class="right chevron icon"></i>
                                    </a>
                                </div>
                                <a href="#" th:href="@{/admin/tags/input}" class="ui right floated teal button">新增</a>
                            </th>
                        </tr>
                    </tfoot>
            </table>
        </div>
    </div>
    <br>
    <br>
    
    <footer th:replace="admin/_fragments :: footer" ></footer>

    <script>
        $('.m-menu-toggle').click(function() {
            $('.m-item').toggleClass('m-mobile-hide');
        });

        $('.ui.dropdown').dropdown({
            on: 'hover'
        });
        
        $(' .message .close').on('click',function(){
        	$(this).closest('.message').transition('fade');
        });
        
    </script>
</body>

</html>